package com.ys.zero.dao;

import java.util.List;

import com.ys.zero.bean.User;
import com.ys.zero.util.DBHelper;
import com.ys.zero.util.VerifyRound;

/**
 * 
 * 管理员后台Dao
 *
 */
public class ManageBackDao {

	/**
	 * 查询管理员
	 * @return
	 */
	public List<User> queryManages() {
		String sql = "select * from user where role=0 or role=00";
		return DBHelper.query(sql, User.class);
	}
	/**
	 * 增加管理员
	 * @return 
	 */
	public void addManages(Object ...params) {
		try {
			String sql = "insert into user(account,pwd,real_name,location,superior,sex,telphone,email,introduction) values(?,?,?,?,?,?,?,?,?)";
			DBHelper.update(sql,params);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	/**
	 * 修改密码
	 * @param id
	 * @param newPwd
	 */
	public void updatePwd(String id, String newPwd) {
		try {
			String sql = "update user set pwd = ? where id = ?";
			DBHelper.update(sql,newPwd,id);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
}
